import React, { useCallback } from 'react'
import { useNavigate } from 'react-router-dom'

export default function Center() {
  const navigate = useNavigate()
  const logout = useCallback(() => {
    localStorage.removeItem('token')
    navigate('/')
  }, [navigate])

  return (
    <div>
      Center
      <button onClick={() => logout()}>注销</button>
    </div>
  )
}
